{
  "$schema" : "http://json-schema.org/draft/2019-09/schema#",
  "title" : "Cheque Extract",
  "type" : "object",
  "additionalProperties" : false,
  "properties" : {
    "identifier" : {
      "type" : "integer",
      "description" : "Unique identifier for each file that is produced or processed by CMP"
    },
    "version" : {
      "type" : "number",
      "minimum" : 0.0,
      "maximum" : 99.99,
      "description" : "The current version of the generic extract file"
    },
    "interfaceCategory" : {
      "type" : "string",
      "enum" : [ "Payments" ],
      "description" : "CMP categorisation of the job associated with this file "
    },
    "interfaceType" : {
      "type" : "string",
      "enum" : [ "Recurring Cheque Payments" ],
      "description" : "Sub-categorisation of the job"
    },
    "batchDateTime" : {
      "type" : "string",
      "format" : "date-time",
      "description" : "Represents when a batch was created in CMP"
    },
    "extractLoadDateTime" : {
      "type" : "string",
      "format" : "date-time",
      "description" : "Represents when a generic CMP file was created from a batch"
    },
    "refundTotal" : {
      "type" : "number",
      "minimum" : 1.0,
      "maximum" : 9.999999999999998E13,
      "description" : "Total value of refunds transactions in the extract file"
    },
    "recordCount" : {
      "type" : "integer",
      "description" : "Number of records within the original batch"
    },
    "details" : {
      "type" : "array",
      "items" : {
        "$ref" : "#/definitions/ChequeExtractDetail"
      },
      "description" : "Details of cheque refund"
    }
  },
  "required" : [ "identifier", "version", "interfaceCategory", "interfaceType", "batchDateTime", "extractLoadDateTime", "refundTotal", "recordCount", "details" ],
  "definitions" : {
    "ChequeExtractDetail" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "detailSequence" : {
          "type" : "integer",
          "description" : "Unique identifier of the detail record within the current extract"
        },
        "payeeName" : {
          "$ref" : "#/definitions/PayeeName",
          "description" : "The Person to receive the cheque"
        },
        "dateOfIssue" : {
          "type" : "string",
          "format" : "date-time",
          "description" : "Date of Issue of the Refund"
        },
        "amount" : {
          "type" : "number",
          "minimum" : 0.0,
          "maximum" : 9.999999999999E10,
          "description" : "Amount of the refund"
        },
        "drawee" : {
          "$ref" : "#/definitions/Drawee",
          "description" : "The financial institution where the cheque can be presented for payment"
        },
        "drawerName" : {
          "type" : "string",
          "maxLength" : 100,
          "description" : "This represents the organisation making the cheque"
        },
        "MICR" : {
          "$ref" : "#/definitions/MICR",
          "description" : "This provides information about the account the cheque is drawn from"
        }
      },
      "required" : [ "detailSequence", "payeeName", "dateOfIssue", "amount", "drawerName", "MICR" ]
    },
    "PayeeName" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "title" : {
          "type" : "string",
          "maxLength" : 10,
          "description" : "Title of the payee"
        },
        "forename" : {
          "type" : "string",
          "maxLength" : 50,
          "description" : "Forename of the payee"
        },
        "middlename" : {
          "type" : "string",
          "maxLength" : 20,
          "description" : "Middlename of the payee"
        },
        "surname" : {
          "type" : "string",
          "maxLength" : 50,
          "description" : "Surname of the payee"
        },
        "addressLines" : {
          "type" : "array",
          "minItems" : 0,
          "maxItems" : 5,
          "items" : {
            "$ref" : "#/definitions/PayeeAddressLine"
          },
          "description" : "Payee address information"
        },
        "postCode" : {
          "type" : "string",
          "maxLength" : 10,
          "description" : "Post Code associated with the delivery address"
        }
      },
      "required" : [ "surname" ]
    },
    "PayeeAddressLine" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "line" : {
          "type" : "string",
          "maxLength" : 60,
          "description" : "Address where refund cheque will be sent to"
        }
      }
    },
    "Drawee" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "name" : {
          "type" : "string",
          "maxLength" : 100,
          "description" : "Name of the drawee"
        },
        "addressLines" : {
          "type" : "array",
          "minItems" : 0,
          "maxItems" : 5,
          "items" : {
            "$ref" : "#/definitions/AddressLine"
          },
          "description" : "Address Line Information"
        }
      },
      "required" : [ "name" ]
    },
    "AddressLine" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "line" : {
          "type" : "string",
          "maxLength" : 60,
          "description" : "Address of the financial institution that issues cheque"
        }
      }
    },
    "MICR" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "cheque" : {
          "type" : "string",
          "maxLength" : 60,
          "description" : "Cheque number"
        },
        "bankIdentifier" : {
          "type" : "string",
          "maxLength" : 20,
          "description" : "Bank Identifier"
        },
        "bankAccountNumber" : {
          "type" : "string",
          "maxLength" : 40,
          "description" : "Bank Account Number"
        }
      },
      "required" : [ "cheque", "bankIdentifier", "bankAccountNumber" ]
    }
  }
}